package com.jmp.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.util.List;

@Data
public class TenxunImReceiveRequest {
    @JsonProperty("From_Account")
    private String From_Account;
    @JsonProperty("To_Account")
    private String To_Account;
    @JsonProperty("MsgBody")
    private List<Msg> MsgBody;
    @JsonProperty("Info")
    private Info Info;


    @Data
    public static class Msg {
        @JsonProperty("MsgType")
        private String MsgType;
        @JsonProperty("MsgContent")
        private MsgContent MsgContent;
    }

    @Data
    public static class MsgContent {
        @JsonProperty("Text")
        private String Text;
    }

    @Data
    public static class Info {
        @JsonProperty("Action")
        private String Action;
        @JsonProperty("To_Account")
        private String To_Account;
        @JsonProperty("Reason")
        private String Reason;

        public boolean isLogin() {
            return "Login".equals(getAction());
        }
    }
}
